package com.project.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.project.entity.ProjectInfo;
import com.project.service.ProjectInfoService;
import com.project.service.Impl.ProjectInfoServiceImpl;

public class AddProjectSrtvlet extends HttpServlet {
	ProjectInfoService impl = new ProjectInfoServiceImpl();
	protected void service(HttpServletRequest request, HttpServletResponse response) 
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		ProjectInfo pro = new ProjectInfo();
		pro.setProjectName(request.getParameter("projectName"));
		pro.setStartDate(request.getParameter("startDate"));
		pro.setEndDate(request.getParameter("endDate"));
		pro.setStatus(Integer.parseInt(request.getParameter("staus")));
		int line = impl.zeng(pro);
		if(line>0) {
		response.sendRedirect("ProjectInfoServlet");
		}else {
			response.sendRedirect("add.jsp");
		}
	}
}
